{extend name='base' /}
{block name='content'}
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-header">
                <h4>视频添加</h4>
              </div>
              <div class="card-body">
                <div class="alert alert-success" role="alert">所属课程：{$pro.pro_name}</div>
                <form action="#!" method="post" class="row" >
                  <div class="form-group col-md-12">
                    <label>视频名称</label>
                    <input type="text" class="form-control" id="video_name" name="video_name" value=""  placeholder="请输入课程名称" />
                  </div>
                  <div class="form-group col-md-12">
                    <label>视频排序</label>
                    <input type="number" class="form-control" id="video_sort" name="video_sort"  value="10" placeholder="请输入课程排序"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label>视频资源</label>
                    <div class="input-group" id="video-group">
                      <input type="text" class="form-control" multiple="multiple" name="video_url" id="video_url" value="" placeholder="填写视频资源地址或者上传视频">
                      <div class="input-group-btn">
                        <button type="button" class="layui-btn" id="uploadvideo">
                          <i class="layui-icon">&#xe67c;</i>上传视频
                        </button>
                      </div>
                    </div>
                  </div>
                  <input type="hidden" name="video_pro_id" value="{$pro.pro_id}">
                  <div class="form-group col-md-12">
                    <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">上传</button>
                  </div>
                </form>
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
<script>
  layui.use('upload', function(){
    var upload = layui.upload;

    //执行实例
    var uploadInst = upload.render({
      elem: '#uploadvideo' //绑定元素
      ,accept: 'video'
      ,url: '{:url("admin/upload/uploadvideo")}'//上传接口
      ,done: function(res){
        //上传完毕回调
        $("#video_url").val(res.data.src);
      }
      ,error: function(){
        //请求异常回调
      }
    });
  });
</script>
<script>
{/block}